#include <iostream>
#include <deque>

using namespace std;

//deque赋值操作:给deque容器进行赋值
//函数原型：
//1、deque& operator=(const deque &deq);         //重载等号操作符
//2、assign(beg, end);                           //将[beg, end)区间中的数据拷贝赋值给本身
//3、assign(n, elem);                            //将n个elem拷贝赋值给本身
void printD(const deque<int> &d) {
    for (deque<int>::const_iterator it = d.begin(); it != d.end(); ++it) {
        cout << *it << " ";
    }
    cout << endl;
}

void test() {
    deque<int> d1;
    for (int i = 0; i < 10; ++i) {
        d1.push_back(i * i);
    }
    printD(d1);

    deque<int> d2;//operator=赋值
    d2 = d1;
    printD(d2);

    deque<int> d3;//assign赋值
    d3.assign(d1.begin(), d1.end());
    printD(d3);

    deque<int> d4;
    d4.assign(10, 100);
    printD(d4);
}

int main() {
    test();
    return 0;
}